package com.shuang.string1;


public class ReverseString {

    public void reverseString(char[] s) {
        //双指针方法

        if (s == null || s.length == 0){
            return;
        }

        //左右指针
        int left = 0;
        int right = s.length - 1;

        char temp;
        //交换
        while (left < right){
            temp = s[left];
            s[left] = s[right];
            s[right] = temp;

            left++;
            right--;
        }
    }
}
